package org.behrang.macbeans.tab;

import java.awt.Color;
import java.awt.Component;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.geom.Line2D;
import java.awt.geom.Rectangle2D;
import javax.swing.UIManager;
import javax.swing.border.Border;
import org.behrang.macbeans.Utils;

/**
 *
 * @author behrangsa
 */
public class UpperTabControlBorder implements Border, TabControlColors {

    public Insets getBorderInsets(Component c) {
        return new Insets(0, 1, 0, 1);
    }

    public boolean isBorderOpaque() {
        return true;
    }

    public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {        
        Color old = g.getColor();
        
        final int w = 9;
        final int h = 22;
        
        // background
        g.setColor(new Color(120, 120, 120));
        g.fillRect(x, y, w - 1, h);
        
        // upper bright line
        g.setColor(new Color(174, 174, 174));
        g.drawLine(x, y, x + w, y);
        
        // upper dark line
        g.setColor(new Color(64, 64, 64));
        g.drawLine(x, y + 1, x + w, y + 1);
        
        // lower dark line
        g.drawLine(x, y + h, x + w, y + h);
        
        // left dark line        
        g.drawLine(x, y + 1, x, y + h + 2);
        
        // right dark line
        g.drawLine(x + width - 1, y + 1, x + width - 1, y + h  + 2);
        
        // Utils.prints("x+width = ", x + width);
        
        g.setColor(new Color(153, 153, 153));
        // lower bright line
        g.drawLine(x + 1, y + h - 1, x + w, y + h - 1);
        
        
        
        g.setColor(old);
    }
    
}
